/**
 * Created by huiran on 2017/5/20.
 */


    $(function(){
        //记录图片的索引，初始是第一张
        var index = 0;
        //自动播放图片
        var timer = setInterval(nextImg,1000);
        //下一张图片
        function nextImg(){
            index = index == $(".zhucai-content.display .pic a").length - 1 ? 0 : index + 1;
            showImg();
        }
        //上一张图片
        function prevImg(){
//						console.log(22)
            index = index == 0 ? $(".zhucai-content.display .pic a").length-1 : index - 1;
            showImg();
        }
        function showImg(){
            $(".zhucai-content.display .pic a")
                .eq(index).show()
                .siblings().hide();

            $(".zhucai-content.display .indicator span")
                .eq(index).addClass("active")
                .siblings().removeClass("active")
//						console.log(33)
        }
        //手动切换图片
        $(".zhucai-content.display .indicator span").hover(function(){

            clearInterval(timer);

            index = $(this).index();
            showImg()

        },function(){
            timer = setInterval(nextImg,1000)
        });

        $('.zhucai-select li').hover(function () {
            var num = $(this).index();
            $(this).addClass('curs')
                    .siblings().removeClass('curs');
            $('.zhucai-content').eq(num).addClass('display')
                                .siblings('.zhucai-content').removeClass('display');
        })

    });
//    标准工序轮播
(function () {
    var width = $(".teacher li").width(); //每个li的宽
    $('.prev').click(function () {
        $(".teacher").animate({
            left: -width
        },100,function(){
            $(".teacher").css("left","0").children('li').first().appendTo(".teacher");
        })
    });
//    向右点击移动
    $('.next').click(function () {
        $(".teacher").animate({
            left: width
        },100,function(){
            $(".teacher").css("left","0").children('li').last().prependTo(".teacher");
        })

    })
})();
//标准工序
(function () {
    $('.art-select li').hover(function () {
        var num = $(this).index();
        $(this).addClass('se-hover')
            .siblings().removeClass('se-hover');
        $('.art-none').eq(num).addClass('display')
            .siblings('.art-none').removeClass('display');
    })
})();


